<!--菜单维护-->
<template>
  <div class="page">
    <div class="top-search">
      <div class="top-search-item">
        <el-button type="primary" size="mini">新增同级菜单</el-button>
      </div>
      <div class="top-search-item">
        <el-button type="primary" size="mini">新增下级菜单</el-button>
      </div>
      <div class="top-search-item">
        <el-button type="primary" size="mini">上移</el-button>
      </div>
      <div class="top-search-item">
        <el-button type="primary" size="mini">下移</el-button>
      </div>
      <div class="top-search-item">
        <el-button type="primary" size="mini">升级</el-button>
      </div>
      <div class="top-search-item">
        <el-button type="primary" size="mini">降级</el-button>
      </div>
      <div class="top-search-item">
        <el-button type="danger" size="mini">删除</el-button>
      </div>
      <div class="top-search-item">
        <el-button type="primary" size="mini">全部展开</el-button>
      </div>
      <div class="top-search-item">
        <el-button type="primary" size="mini">全部折叠</el-button>
      </div>
      <div class="top-search-item">
        <el-button type="success" size="mini">保存</el-button>
      </div>
    </div>
    <div class="content">
      <el-table
        :data="tableData1"
        style="width: 100%"
        row-key="id"
        border
        :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
      >
        <el-table-column
          align="center"
          label="模块名称"
        >
          <template slot-scope="scope">
            <span class="name-text">
              {{ scope.row.name }}
            </span>
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          label="启用"
        >
          <template slot-scope="scope">
            <span class="name-text">
              <el-checkbox v-model="scope.row.use">备选项</el-checkbox>
            </span>
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          label="链接地址"
        />
        <el-table-column
          align="center"
          label="areaId"
        />
      </el-table>
    </div>
    <div class="page">
      <el-pagination
        :current-page="currentPage"
        :page-size="20"
        layout="total, prev, pager, next, jumper"
        :total="0"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
      />
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      tableData1: [{
        id: 1,
        name: 'AAA',
        use: true,
        children: [{
          id: 12,
          name: 'A1',
          use: true
        }, {
          id: 13,
          name: 'A2',
          use: false
        }]
      }],
      multipleSelection: [],
      currentPage: 1
    }
  },
  methods: {
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`)
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`)
    },
    handleSelectionChange(val) {
      this.multipleSelection = val
    }
  }
}
</script>

<style lang="scss" scoped>
.page {
  padding: 1rem;

  .top-search {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-direction: row;

    .top-search-item {
      margin-right: 1rem;
    }
  }

  .content {
    margin-top: 2rem;
    width: 100%;
    height: 40rem;
  }
}

</style>
